<?php
namespace app\api\controller\v1;

use app\common\controller\Api;
use app\common\model\Event;
use app\common\model\EventTicket;
use think\Db;

class EventManagementPersonalDetails extends Api
{
    protected $noNeedLogin = '*';
    protected $noNeedRight = '*';

    public function getInfo()
    {
        $id = $this->request->get('id');
        if (!$id) {
            $this->error('参数错误');
        }

        $info =  Db::name('course_table_autoplan_temp')
            ->alias('e')
            ->field('e.*, et.checkin_time, et.ticket_status, et.use_time')
            ->join('event_ticket et', 'e.id = et.event_id', 'LEFT')
            ->where('e.id', $id)
            ->find();

        if (!$info) {
            $this->error('活动不存在');
        }

        // 获取活动图片
        $info['images'] = explode(',', $info['images']);

        $this->success('获取成功', $info);
    }
}